﻿<Window x:Class="ZephyrLite.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
        Title="Zephyr Lite" Height="357" Width="971" Loaded="Window_Loaded" Closing="ButtonApplicationShutdown">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <Menu Margin="0,0,0,0" Grid.Row="0" IsMainMenu="True">
            <Menu.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFFBFDFE" Offset="0" />
                    <GradientStop Color="#FFD7E9FA" Offset="1" />
                </LinearGradientBrush>
            </Menu.Background>
            <MenuItem Header="_File">
                <MenuItem Header="_Save" Click="ButtonSaveConfig" InputGestureText="Ctrl+S" />
                <MenuItem Header="_Exit" InputGestureText="Ctrl+E" Click="ButtonApplicationShutdown" />
            </MenuItem>
            <MenuItem Header="_Connection">
                <MenuItem Name="_menu_ConnectSterling" Header="Sterling" IsCheckable="True" InputGestureText="Ctrl+C" Checked="ButtonConnectSterlingSimulation_Click" />
                <MenuItem Name="_menu_ConnectBatsReplay" Header="_Bats Replay" Click="ButtonConnectBatsReplay_Click" InputGestureText="Ctrl+B" />
            </MenuItem>
        </Menu>

        <ad:DockingManager x:Name="_dockManager" Grid.Row="1">
            <ad:ResizingPanel Orientation="Vertical">
                <ad:ResizingPanel Orientation="Horizontal">
                    <ad:DockablePane ad:ResizingPanel.ResizeWidth="150"/>
                    <ad:DocumentPane>

                        <ad:DocumentContent x:Name="_dockContent_Fraction" Title="Open Monitor"  IsCloseable="False">
                            <Grid>
                                <DataGrid  Name="_dataGrid_FractionOpenMonitor"  Margin="6,6,6,6" FrozenColumnCount="1" AlternatingRowBackground="#FFE9ECFA" Height="Auto" Width="Auto">
                                    <DataGrid.Columns>
                                        <DataGridTextColumn Header="SymbolA" Binding="{Binding SymbolA, Mode=OneWay}" />
                                        <DataGridTextColumn Header="Close" Binding="{Binding CloseA, StringFormat=\{0:F2\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="Open" Binding="{Binding OpenA, StringFormat=\{0:F2\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="Move" Binding="{Binding OpenMoveA, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTextColumn Header="SymbolB" Binding="{Binding SymbolB, Mode=OneWay}" />
                                        <DataGridTextColumn Header="Close" Binding="{Binding CloseB, StringFormat=\{0:F2\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="Open" Binding="{Binding OpenB, StringFormat=\{0:F2\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="Move" Binding="{Binding OpenMoveB, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTextColumn Header="Difference" Binding="{Binding OpenDifference, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />                                        
                                    </DataGrid.Columns>
                                </DataGrid>
                            </Grid>
                        </ad:DocumentContent>
                        <ad:DocumentContent x:Name="_dockContent_FractionOpenSettings" Title="Open Settings"  IsCloseable="False">
                            <Grid>
                                <TextBox Height="23" HorizontalAlignment="Left" Margin="6,6,0,0" Name="_textBox_FractionOpenSettings_StockA" VerticalAlignment="Top" Width="60" />
                                <TextBox Height="23" HorizontalAlignment="Left" Margin="68,6,0,0" Name="_textBox_FractionOpenSettings_StockB" VerticalAlignment="Top" Width="60" />
                                <Button Name="_button_FractionOpenSettingsAdd" Content="Add" IsDefault="True" Height="23" Margin="135,6,0,0" VerticalAlignment="Top" IsEnabled="False" HorizontalAlignment="Left" Width="31" Click="ButtonFractionOpenSettingsAdd_Click" />
                                <DataGrid  Name="_dataGrid_FractionOpenSettings"  Margin="6,35,6,6" FrozenColumnCount="1" AlternatingRowBackground="#FFE9ECFA" Height="Auto" Width="Auto">
                                    <DataGrid.Columns>
                                        <DataGridTextColumn Header="Symbol A" Binding="{Binding SymbolA}" CellStyle="{StaticResource ResourceKey=AlignLeftEditable}" />
                                        <DataGridTextColumn Header="Symbol B" Binding="{Binding SymbolB}" CellStyle="{StaticResource ResourceKey=AlignLeftEditable}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridCheckBoxColumn Header="Enabled" Binding="{Binding IsEnabled}" CellStyle="{StaticResource ResourceKey=Editable}" />
                                        <DataGridCheckBoxColumn Header="Triggered" Binding="{Binding IsTriggered, Mode=OneWay}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTextColumn Header="Value" Binding="{Binding Value}" CellStyle="{StaticResource ResourceKey=AlignRightEditable}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTextColumn Header="Difference" Binding="{Binding OpenDifference, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="EntryTrigger" Binding="{Binding Trigger, StringFormat=\{0:F4\}}" CellStyle="{StaticResource ResourceKey=AlignRightEditable}"  />
                                        <DataGridTextColumn Header="ExitTrigger" Binding="{Binding Exit, StringFormat=\{0:F4\}}" CellStyle="{StaticResource ResourceKey=AlignRightEditable}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTemplateColumn Header="Remove">
                                            <DataGridTemplateColumn.CellTemplate>
                                                <DataTemplate>
                                                    <Button Click="ButtonFractionOpen_Remove_Click" Width="16" Height="16" />
                                                </DataTemplate>
                                            </DataGridTemplateColumn.CellTemplate>
                                        </DataGridTemplateColumn>
                                    </DataGrid.Columns>
                                </DataGrid>
                            </Grid>
                        </ad:DocumentContent>


                        <ad:DocumentContent x:Name="_dockContent_FractionDayMonitor" Title="Day Monitor"  IsCloseable="False">
                            <Grid>
                                <DataGrid  Name="_dataGrid_FractionDayMonitor"  Margin="6,6,6,6" FrozenColumnCount="1" AlternatingRowBackground="#FFE9ECFA" Height="Auto" Width="Auto">
                                    <DataGrid.Columns>
                                        <DataGridTextColumn Header="Symbol A" Binding="{Binding SymbolA, Mode=OneWay}" />
                                        <DataGridTextColumn Header="Time" Binding="{Binding TimeA, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="Last" Binding="{Binding LastA, StringFormat=\{0:F2\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="Mid" Binding="{Binding MidA, StringFormat=\{0:F2\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="Close" Binding="{Binding CloseA, StringFormat=\{0:F2\}}" CellStyle="{StaticResource ResourceKey=AlignRightEditable}" />
                                        <DataGridTextColumn Header="Move" Binding="{Binding DayMoveA, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTextColumn Header="Symbol B" Binding="{Binding SymbolB, Mode=OneWay}" />
                                        <DataGridTextColumn Header="Time" Binding="{Binding TimeB, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="Last" Binding="{Binding LastB, StringFormat=\{0:F2\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="Close" Binding="{Binding CloseB, StringFormat=\{0:F2\}}" CellStyle="{StaticResource ResourceKey=AlignRightEditable}" />
                                        <DataGridTextColumn Header="Mid " Binding="{Binding MidB, StringFormat=\{0:F2\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="Move" Binding="{Binding DayMoveB, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTextColumn Header="Difference" Binding="{Binding DayDifference, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                    </DataGrid.Columns>
                                </DataGrid>
                            </Grid>
                        </ad:DocumentContent>
                        <ad:DocumentContent x:Name="_dockContent_FractionDaySettings" Title="Day Settings"  IsCloseable="False">
                            <Grid>
                                <TextBox Height="23" HorizontalAlignment="Left" Margin="6,6,0,0" Name="_textBox_FractionDaySettings_StockA" VerticalAlignment="Top" Width="60" />
                                <TextBox Height="23" HorizontalAlignment="Left" Margin="68,6,0,0" Name="_textBox_FractionDaySettings_StockB" VerticalAlignment="Top" Width="60" />
                                <Button Name="_button_FractionDaySettingsAdd" Content="Add" IsDefault="True" Height="23" Margin="135,6,0,0" VerticalAlignment="Top" IsEnabled="False" HorizontalAlignment="Left" Width="31" Click="ButtonFractionDaySettingsAdd_Click" />
                                <DataGrid  Name="_dataGrid_FractionDaySettings"  Margin="6,35,6,6" FrozenColumnCount="1" AlternatingRowBackground="#FFE9ECFA" Height="Auto" Width="Auto">
                                    <DataGrid.Columns>
                                        <DataGridTextColumn Header="Symbol A" Binding="{Binding SymbolA}" CellStyle="{StaticResource ResourceKey=AlignLeftEditable}" />
                                        <DataGridTextColumn Header="Symbol B" Binding="{Binding SymbolB}" CellStyle="{StaticResource ResourceKey=AlignLeftEditable}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridCheckBoxColumn Header="Enabled" Binding="{Binding IsEnabled}" CellStyle="{StaticResource ResourceKey=Editable}" />
                                        <DataGridCheckBoxColumn Header="Triggered" Binding="{Binding IsTriggered, Mode=OneWay}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTextColumn Header="Value" Binding="{Binding Value}" CellStyle="{StaticResource ResourceKey=AlignRightEditable}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTextColumn Header="Difference" Binding="{Binding DayDifference, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="EntryTrigger" Binding="{Binding Trigger, StringFormat=\{0:F4\}}" CellStyle="{StaticResource ResourceKey=AlignRightEditable}" />
                                        <DataGridTextColumn Header="ExitTrigger" Binding="{Binding Exit, StringFormat=\{0:F4\}}" CellStyle="{StaticResource ResourceKey=AlignRightEditable}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTemplateColumn Header="Remove">
                                            <DataGridTemplateColumn.CellTemplate>
                                                <DataTemplate>
                                                    <Button Click="ButtonFractionDay_Remove_Click" Width="16" Height="16" />
                                                </DataTemplate>
                                            </DataGridTemplateColumn.CellTemplate>
                                        </DataGridTemplateColumn>
                                    </DataGrid.Columns>
                                </DataGrid>
                            </Grid>
                        </ad:DocumentContent>


                        <ad:DocumentContent x:Name="_dockContent_FractionTriggers" Title="Triggers"  IsCloseable="False">
                            <Grid>
                                <DataGrid  Name="_dataGrid_FractionTriggers"  Margin="6,35,6,6" FrozenColumnCount="1" AlternatingRowBackground="#FFE9ECFA" Height="Auto" Width="Auto">
                                    <DataGrid.Columns>
                                        <DataGridTextColumn Header="Time" Binding="{Binding TimeIn, Mode=OneWay}" />
                                        <DataGridTextColumn Header="Symbol A" Binding="{Binding SymbolA, Mode=OneWay}" />
                                        <DataGridTextColumn Header="Symbol B" Binding="{Binding SymbolB, Mode=OneWay}" />
                                        <DataGridTextColumn Header="Value" Binding="{Binding Value, Mode=OneWay}" CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTextColumn Header="ExitTrigger" Binding="{Binding ExitTrigger, StringFormat=\{0:F4\}}" CellStyle="{StaticResource ResourceKey=AlignRightEditable}" />
                                        <DataGridTextColumn Header="Current" Binding="{Binding TriggerDifference, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTextColumn Header="Entry" Binding="{Binding Entry, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="Exit" Binding="{Binding Exit, StringFormat=\{0:F4\}, Mode=OneWay}" CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTextColumn Header="PnL" Binding="{Binding PnL, StringFormat=\{0:F2\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="Pos A" Binding="{Binding PositionA, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTemplateColumn Header="Cut" CellStyle="{StaticResource ResourceKey=Editable}">
                                            <DataGridTemplateColumn.CellTemplate>
                                                <DataTemplate>
                                                    <Button Click="ButtonFractionTrigger_ExitA" Width="20" Height="20">A</Button>
                                                </DataTemplate>
                                            </DataGridTemplateColumn.CellTemplate>
                                        </DataGridTemplateColumn>
                                        <DataGridTextColumn Header="Pos B" Binding="{Binding PositionB, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTemplateColumn Header="Cut" CellStyle="{StaticResource ResourceKey=Editable}">
                                            <DataGridTemplateColumn.CellTemplate>
                                                <DataTemplate>
                                                    <Button Click="ButtonFractionTrigger_ExitB" Width="20" Height="20">B</Button>
                                                </DataTemplate>
                                            </DataGridTemplateColumn.CellTemplate>
                                        </DataGridTemplateColumn>
                                        <DataGridTextColumn Header=" " />
                                        <DataGridTextColumn Header="QtyAIn" Binding="{Binding QuantityAIn, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="PriceAIn" Binding="{Binding PriceAIn, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="QtyAOut" Binding="{Binding QuantityAOut, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="PriceAOut" Binding="{Binding PriceAOut, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="QtyBIn" Binding="{Binding QuantityBIn, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="PriceBIn" Binding="{Binding PriceBIn, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="QtyBOut" Binding="{Binding QuantityBOut, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="PriceBOut" Binding="{Binding PriceBOut, StringFormat=\{0:F4\}, Mode=OneWay}" IsReadOnly="True"  CellStyle="{StaticResource ResourceKey=AlignRight}" />
                                        <DataGridTextColumn Header="ExitTime" Binding="{Binding TimeOut, Mode=OneWay}" />
                                    </DataGrid.Columns>
                                </DataGrid>
                            </Grid>
                        </ad:DocumentContent>

                    </ad:DocumentPane>
                </ad:ResizingPanel>
            </ad:ResizingPanel>
        </ad:DockingManager>
        
        <StatusBar Grid.Row="2">
            <StatusBarItem Name="_statusBar_ItemVersion" Content="Zephyr x.x.x.x"/>
            <Separator />
            <StatusBarItem Name="_statusBar_ConnectionSterling" Content="Sterling" />
            <StatusBarItem Name="_statusBar_ConnectionBatsReplay" Content="Bats Replay" />
            <Separator />
            <StatusBarItem />
        </StatusBar>

    </Grid>
</Window>
